Repository navigation
docs(tutorials): repair and conform the Study design tutorials (04, 05, 06, 07, 24), with drift tests - #916
Merged
Merged
Conversation
…5, 06, 07, 24), with drift tests
✅ Looks goodNo unmitigated P0 or P1 findings identified in the supplied changes. Executive summary
Methodology
The first-difference restriction, smoothness interpretation, pre-test conditioning simulation, and CS estimand descriptions are consistent with the cited methodology. Code QualityNo findings. Changes are confined to tutorials, documentation, and tests. PerformanceNo findings. The new simulation-heavy power tests are marked MaintainabilityNo findings. Removing repaired notebooks from the convention allowlist preserves the ratchet. Tech Debt
SecurityNo findings in the supplied changes. Documentation/TestsNo actionable findings. Verification completed:
Full numerical drift tests and notebook re-execution remain unverified locally because the required dependencies are unavailable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third PR of the post-4.0 tutorial repair (after #906 and #911). Fixes the defects found in the Study design tutorials and brings each to the tutorial conventions in CONTRIBUTING.md, keeping each notebook's own narrative. Every notebook is committed with executed outputs (Rust backend) and has a drift test that pins the numbers its prose quotes.
04_parallel_trends: pre-treatment diagnostics are presented as evidence, not as a pass/fail gate. The group placebo now passestreatment=, so treated units are dropped (without it they sat in the placebo control group). The permutation example no longer labels the placebo mean as the estimate.05_honest_did: the relative-magnitudes restriction is stated on first differences, as implemented (it was written on levels, which cannot reproduce the output). The breakdown value is searched on a grid that reaches it. The conventional interval is shown to miss the simulated truth where both honest intervals cover it. Relative magnitudes and smoothness are no longer compared at "the same M".06_power_analysis: closed-form and simulated sample sizes are compared for the same design (32 against 35 units; the old comparison set 63 against 42 and blamed simulation noise).sigmaandrhoare defined once. Panel simulations cluster by unit.07_pretrends_power: the linear minimum detectable violation is treated as a slope and translated into the bias it implies, and is no longer passed to Honest DiD as a smoothness bound. Power grids sit on the scale of the MDV instead of saturating at 100%. The form of the pre-test is named. A new section shows by simulation that, in the notebook's design, bias is larger and coverage lower among the samples that pass the pre-test.24_staggered_vs_collapsed_power: the removedoverall_attname is gone from the prose; the event study is drawn withplot_event_study; blanket warning filters are removed (the fits are warning-free); the claim that thesimulate_*functions draw independently per estimator is corrected.tests/test_tutorial_conventions.py: the five notebooks leave the ratchet allowlist.docs/tutorials/index.rst: card text for the touched notebooks.TODO.md: three small library items found along the way (power evaluated at the MDV under the defaultM=None; "Residual SD" wording forsigma;seed=insimulate_*seeds the data generator only).Not touched:
34_design_diagnosis.ipynb.Methodology references (required if estimator / math changes)
docs/methodology/REGISTRY.md.Validation
tests/test_t04_parallel_trends_drift.py,tests/test_t05_honest_did_drift.py,tests/test_t06_power_analysis_drift.py,tests/test_t07_pretrends_power_drift.py(new);tests/test_t24_staggered_vs_collapsed_power_drift.py,tests/test_tutorial_conventions.py(updated). 334 passed on each backend, slow tests included, together with the docs IA, tracking-file and changelog guards.main, notebooks 04, 05, 07 and 24 were re-executed on the Rust backend with no output differences from the committed outputs, and passpytest --nbmakeon the pure-Python backend. 06 is excluded from that CI job for runtime; its drift test, slow tests included, passes on both backends. The Sphinx-Wbuild and the search-excerpt smoke test pass locally.Security / privacy
Changelog
changelog.d/20261125-tutorials-study-design.md)